<link href="/stylesheets/tabheader.css" rel="stylesheet" type="text/css" />
<table width="100%" class="noborder_padding">
  <tr>
    <td width="200px" valign="top">
      <%=render :partial=>"sidemenu"%>
    </td>
    <td valign="top" style="padding-left: 10px;">
      <%=render :partial=>"tabheader"%>
      <h3><font color="#804040">Reference Paper</font><%if @word%><font color="red"><i> &nbsp;&nbsp;&nbsp; "<%=@word%>"</i></font><%end%></h3>
      <table class="basic_table" width="100%">
        <tr>
          <th>No.</th>
          <th>Name</th>
          <th>File</th>
          <th></th>
        </tr>
        <%@papers.each_with_index do |p,i|%>
        <tr>
          <td align="center"><%=i+1%></td>
          <td><%=p.name%></td>
          <td align="center">
            <%if p.a_type=='I'%>
              <a href="/attachment/showfile/<%=p.gencode%>" target="_blank"><img src="/images/newspaper.png" border="0"/></a>
            <%else%>
              <a href="<%=p.url%>" target="_blank"><img src="/images/newspaper.png" border="0"/></a>
            <%end%>
          </td>
          <td align="center"><a href="/project/delete_paper/<%=p.gencode%>" onclick="return confirm('ต้องการลบจริงหรือไม่?');"><img src="/images/delete.png" border="0"/></a></td>
        </tr>
        <%end%>
      </table>
      <br/>
      <%= form_tag( { :controller=>'project', :action=>'upload_paper'}, :multipart => true ) %>
        <span class="style1"><b>Upload Paper</b></span><br/>
        <table>
                <tr>
                        <td>Name :</td>
                        <td><input id="attachment_name" name="attachment[name]" style="width:500px;" type="text" value=""/></td>
                </tr>
                <tr>
                        <td>Select File :</td>
                        <td><input type="file" name="attachment[tmp_file]" style="width:500px;"/></td>
                </tr>
                <tr>
                        <td>or Specific URL :</td>
                        <td><input type="text" name="attachment[url]" style="width:500px;" value=""/></td>
                </tr>
                <tr>
                        <td></td>
                        <td><input type="submit" value="Upload"/></td>
                </tr>
        </table>
        </form>
    </td>
  </tr>
</table>